package com.pkx.cloud.fse7.expand.plan.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.cloud.fse7.expand.plan.entity.DoorPlanDetail;
import com.pkx.cloud.fse7.expand.plan.service.DoorPlanDetailService;
import com.pkx.cloud.whzx.comn.ORpose;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 控制器
 *
 * @author chenwg
 * @since 2021-04-09
 */
@RestController
@RequestMapping("/plan/door-plan-detail")
@Api(value = "门禁计划详情", tags = "门禁计划详情")
@Slf4j
@ORpose
public class DoorPlanDetailController {

    @Autowired
    private DoorPlanDetailService doorPlanDetailService;

    @ApiOperation("分页列表")
    @GetMapping("/page")
    public Page<DoorPlanDetail> page(Page page, DoorPlanDetail doorPlanDetail) {
        return doorPlanDetailService.pageList(page, doorPlanDetail);
    }

    @ApiOperation("列表")
    @GetMapping("/list")
    public List<DoorPlanDetail> list(DoorPlanDetail doorPlanDetail) {
        return doorPlanDetailService.listByEntity(doorPlanDetail);
    }

    @ApiOperation("详情")
    @GetMapping(value = "/{id}")
    public DoorPlanDetail selectById(@PathVariable("id") String id) {
        return doorPlanDetailService.selectById(id);
    }

    @ApiOperation("新增")
    @PostMapping("")
    public Boolean add(@RequestBody DoorPlanDetail doorPlanDetail) {
        return doorPlanDetailService.saveDoorPlanDetail(doorPlanDetail);
    }

    @ApiOperation("修改")
    @PutMapping("")
    public Boolean modify(@RequestBody DoorPlanDetail doorPlanDetail) {
        return doorPlanDetailService.modify(doorPlanDetail);
    }

    @ApiOperation("删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    public Boolean deleteById(@PathVariable("id") String id) {
        return doorPlanDetailService.deleteById(id);
    }


}
